<!--  -->
<template>
  <div>
    <ul>
      <li>消息1</li>
      <li>消息2</li>
      <li>消息3</li>
      <li>消息4</li>
    </ul>
  </div>
</template>

<script>
// 声明一个实例
import axios from "axios";
const instance1 = axios.create({
  baseURL: "http://httpbin.org/patch",
  timeout: 5000,
});

// 对实例进配置
instance1({
  url: "",
}).then((res) => console.log(res));

// 对实例进行配置
instance1({
  url: "/home/data",
  method: "get",
  data: {
    firstName: "Fred",
    lastName: "Flintstone",
  },
});

// 将配置好的实例，放到 插件的实例里面，在上面进行显示
export default {
  name: "",
  data() {
    return {
      result: "",
    };
  },
  created() {
    instance1({
      url: "/home/data",
      method: "get",
      data: {
        firstName: "Fred",
        lastName: "Flintstone",
      },
    }).then((res) => {
      console.log(res);
      this.result = res;
    });
  },
};
</script>

<style  scoped>
</style>
